<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
<meta http-equiv="Pragma" content="no-cache"/> 
<meta http-equiv="Cache-Control" content="no-cache"/> 
<meta http-equiv="Expires" content="0"/> 
<title>后台管理</title>
<link href="/static/css/login.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.3.3/themes/default/easyui.css"></link>
<link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.3.3/themes/icon.css"></link>
<script type="text/javascript" src="/static/jquery-easyui-1.3.3/jquery.min.js"></script>
<script type="text/javascript" src="/static/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/static/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
	function login(){
		if($("#userName").val()==""){
			$.messager.alert('温馨提示','用户名不能为空');  
			return;
		}
		if($("#password").val()==""){
			$.messager.alert('温馨提示','密码不能为空');  
			return;
		}
		 $.ajax({
	            //几个参数需要注意一下
	                type: "POST",//方法类型
	                dataType: "json",//预期服务器返回的数据类型
	                url: "/user/login" ,//url
	                data: {userName:$("#userName").val(),password:$("#password").val()},
	                success: function (result) {
	                    console.log(result);//打印服务端返回的数据(调试用)
	                    if (result.success) {
	                    	window.location.href="/main.html";
	                    	console.log(result.success);
	                    }else{
	            			$.messager.alert('温馨提示',result.errorInfo);  
	                    }
	                },
	                error : function() {
	                    alert("异常！");
	                }
	            });
		
	}
	
</script>
</head>

<body>
<div class="login_box">
      <div class="login_l_img"><img src="/static/images/login-img.png" /></div>
      <div class="login">
          <div class="login_logo"><a href="#"><img src="/static/images/imglogin.png2.png" /></a></div>
          <div class="login_name">
               <p>基于SpringBoot权限管理系统</p>
          </div>
          <form id="form1">
              <input name="userName" id="userName" type="text"  placeholder="用户名：" />
			  <input name="password"  type="password" id="password" placeholder="密码："/>
              <input value="登录" id="loginBtn"  onclick="login();" type="button"/>
          </form>
      </div>
      <div class="copyright"> 版权所有--By小智© 技术支持：QQ：877657682</div>
</div>
</body>

</html>
